<?php
class Frontend_Form_User_Login extends Zend_Form
{
    public function init()
    {
        $translator = self::$_translatorDefault;

        $this->addElement('text','name',array(
                'filters'       => array('StringTrim','StringToLower'),
                'validators'    => array(
                        'Alpha',
                        array('StringLength',true,array(3,16))
                ),
                'required'      => true,
                'label'         => $translator->translate('username')
        ));

        $this->addElement('password', 'password', array(
                'filters'       => array('StringTrim','StringToLower'),
                'validators'    => array(
                        array('StringLength', true, array(6,20))
                ),
                'required'      => true,
                'label'         => $translator->translate('password')
        ));

        $this->addElement('checkbox','cookies',array(
                'attribs'       => array('checked'=>'checked','value'=>1),
                'label'         => $translator->translate('keep logined'),
        ));

        $this->addElement('submit', 'login', array(
                'required'      => false,
                'ignore'        => true,
                'attribs'       => array('class' => 'button'),
                'label'         => $translator->translate('login'),
        ));

        $this->setDecorators(array(
            'FormElements',
            'HtmlTag',
            array('HtmlTag', array('tag' => 'dl', 'class' => 'zf-form')),
            array('Description', array('placement' => 'prepend', 'class' => 'error')),
            'Form'
        ));
    }
}